Skip to content

Enable bugprone-unchecked-optional-access clang-tidy check#1872

Closed
bavulapati wants to merge 8 commits intosourcemeta:mainfrom
bavulapati:enable-bugprone-unchecked-optional-access
Closed

Enable bugprone-unchecked-optional-access clang-tidy check#1872
bavulapati wants to merge 8 commits intosourcemeta:mainfrom
bavulapati:enable-bugprone-unchecked-optional-access

Conversation

@bavulapati
Copy link
Contributor

@jviotti We are currently using assert before consuming std::optional's value.
The assert won't be present in production builds.
How should we handle this case? What to do in the case where optional doesn't have value?

Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
@jviotti
Copy link
Member

jviotti commented Jul 22, 2025

Unless there is a case I missed and escaped the tests (could be?), I only assert when I'm sure that the optional is set because of some other pre-conditions, etc

Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
@bavulapati
Copy link
Contributor Author

@jviotti PTAL

Signed-off-by: Balakrishna Avulapati <ba@bavulapati.com>
@jviotti
Copy link
Member

jviotti commented Dec 1, 2025

Hey @bavulapati , I'm not sure that are you still working on these, so let me close them to reduce noise. Always feel free to re-open if you ever get back to it

@jviotti jviotti closed this Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants